﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.IO;

namespace MINERP.DAL.CommonDAL
{
    public static class CommonMethodDAL
    {
        private static string conStr = System.Configuration.ConfigurationManager.ConnectionStrings["sqlCon"].ToString();

        #region 获取服务器时间
        /// <summary>
        /// 获取服务器时间
        /// </summary>
        /// <returns></returns>
        public static DateTime GetServerTime()
        {
            try
            {
                using (SqlConnection con = new SqlConnection(conStr))
                {
                    string sql = "Proc_GetDate";
                    SqlCommand cmd = new SqlCommand(sql, con);
                    cmd.CommandType = CommandType.StoredProcedure;
                    con.Open();
                    return Convert.ToDateTime(cmd.ExecuteScalar());
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    
        #endregion
    }
}
